//
//  AddContactCell.m
//  CJRailTransport
//
//  Created by Hank on 2018/2/24.
//  Copyright © 2018年 amplity. All rights reserved.
//

#import "AddContactCell.h"

@implementation AddContactCell
// 设置数据
- (void)setData:(NSMutableArray *)dataArray selectData:(NSMutableArray *)selectDataArray
{
    // 查询数组中是否保存Model
    BOOL isbool = [selectDataArray containsObject:dataArray[self.indexPath.row]];
    
    if (isbool) {
        // 选中状态
        self.checkImage.image = [UIImage imageNamed:@"select_button"];
    }else{
        // 未选中状态
        self.checkImage.image = [UIImage imageNamed:@"noSelect_button"];
    }
    
    _allDataArray = dataArray;
    _selectDataArray = selectDataArray;
    
    AddContactModel *addContactModel = dataArray[self.indexPath.row];
    _image.image = [UIImage imageNamed:addContactModel.image];
    _name.text = addContactModel.name;
    _email.text = addContactModel.email;
}
// 去除分割线
- (UIView *)lineView
{
    return [[UIView alloc]init];
}

#pragma mark - Action
// 复选框 Action
- (IBAction)checkBtnAction:(UIButton *)sender
{
    // 查询数组中是否保存Model
    BOOL isbool = [_selectDataArray containsObject:_allDataArray[self.indexPath.row]];
    // 复选框点击 Block
    _checkImageClickBlock(self.indexPath, _allDataArray[self.indexPath.row], !isbool);
}

@end
